import React, { useState } from 'react'

function App() {

  const [state, setState] = useState(0)
  const [ageState, setAgeState] = useState(12)
  const [personState, setPersonstate] = useState({name: 'qq', age: 123})

  return (
    <div className="App">
       数据{state}
       <button onClick={() => {setState(state + 1)}}>+1</button>
       <button onClick={() => {setState(state - 1)}}>-1</button>
       <hr />
       年龄:{ageState}
       <button onClick={() => {
         setAgeState(ageState + 1)
         setAgeState(ageState + 1)
         setAgeState( (preState) =>  preState + 1 )
         }}>年齡+1</button>
    </div>
  )
}

export default App;
